import { request } from '../../request/http.js';
import regeneratorRuntime from '../../lib/runtime/runtime.js';
Page({
  data: {
    // 轮播图数组
    swiperList: [],
    // 导航数组
    catesList: [],
    //我的发布
    mysell: [],
  },
  onLoad: function (options) {
    this.getSwiperData();
    this.getCatesData();
    this.getmysell();
  },
  onShow(){
    this.getmysell();

  },
  // 获取轮播图数据
  getSwiperData() {
    request({name:'swiper'})
    .then(result=>{
      this.setData({
        swiperList:result.data.message
      })
    })
  },
  // 导航菜单
  getCatesData() {
    request({ name: 'navMenu' })
      .then(result => {
        this.setData({
          catesList: result.data.message
        })
      })
  },


  // 我的发布
  async getmysell() {
    const openid = wx.getStorageSync('OPENID');
    const result = await request({ name: 'mysell', data: { openid: openid } });
    this.setData({ mysell: result.data.message })
  },
  //下拉刷新
  onPullDownRefresh: function () {
    this.getSwiperData();
    this.getCatesData();
    this.getmysell();
  },

})